# Monarc makefile

CC  = gcc
AS  = nasm
LD  = ld
AR  = ar
SED = sed
PL = perl

ifndef BASE
	BASE = ../
endif

INCL = \
	-I$(BASE)/include \
	-I$(BASE)/klibc/include \
	-I$(BASE)/acpica/include
	

DEFINES = \
	-DMONARC

C_OPT = -Wall -O3 -mno-stack-arg-probe -ffreestanding -nostartfiles -nodefaultlibs -nostdlib -nostdinc $(INCL) $(DEFINES)
OC_OPT = -Wall -O3 -mno-stack-arg-probe -ffreestanding -nostartfiles -nodefaultlibs -nostdlib -nostdinc $(INCL) $(DEFINES)

CC_OPT = -Wall -O3 -mno-stack-arg-probe -nostartfiles -fno-builtin -nodefaultlibs -nostdlib -nostdinc $(INCL) $(DEFINES)
OCC_OPT = -Wall -O3 -mno-stack-arg-probe -nostartfiles -fno-builtin -nodefaultlibs -nostdlib -nostdinc $(INCL) $(DEFINES)

MKDIR = mkdir
CP = cp
CAT = cat
RM = rm -f

c_sources = \
	debugger/dbcmds.c \
	debugger/dbdisply.c \
	debugger/dbexec.c \
	debugger/dbfileio.c \
	debugger/dbhistry.c \
	debugger/dbinput.c \
	debugger/dbstats.c \
	debugger/dbutils.c \
	debugger/dbxface.c \
	disassembler/dmbuffer.c \
	disassembler/dmnames.c \
	disassembler/dmobject.c \
	disassembler/dmopcode.c \
	disassembler/dmresrc.c \
	disassembler/dmresrcl.c \
	disassembler/dmutils.c \
	disassembler/dmwalk.c \
	events/evevent.c \
	events/evgpe.c \
	events/evgpeblk.c \
	events/evmisc.c \
	events/evregion.c \
	events/evrgnini.c \
	events/evsci.c \
	events/evxface.c \
	events/evxfevnt.c \
	events/evxfregn.c \
	hardware/hwacpi.c \
	hardware/hwgpe.c \
	hardware/hwregs.c \
	hardware/hwsleep.c \
	hardware/hwtimer.c \
	interpreter/dispatcher/dsfield.c \
	interpreter/dispatcher/dsinit.c \
	interpreter/dispatcher/dsmethod.c \
	interpreter/dispatcher/dsmthdat.c \
	interpreter/dispatcher/dsobject.c \
	interpreter/dispatcher/dsopcode.c \
	interpreter/dispatcher/dsutils.c \
	interpreter/dispatcher/dswexec.c \
	interpreter/dispatcher/dswload.c \
	interpreter/dispatcher/dswscope.c \
	interpreter/dispatcher/dswstate.c \
	interpreter/executer/exconfig.c \
	interpreter/executer/exconvrt.c \
	interpreter/executer/excreate.c \
	interpreter/executer/exdump.c \
	interpreter/executer/exfield.c \
	interpreter/executer/exfldio.c \
	interpreter/executer/exmisc.c \
	interpreter/executer/exmutex.c \
	interpreter/executer/exnames.c \
	interpreter/executer/exoparg1.c \
	interpreter/executer/exoparg2.c \
	interpreter/executer/exoparg3.c \
	interpreter/executer/exoparg6.c \
	interpreter/executer/exprep.c \
	interpreter/executer/exregion.c \
	interpreter/executer/exresnte.c \
	interpreter/executer/exresolv.c \
	interpreter/executer/exresop.c \
	interpreter/executer/exstore.c \
	interpreter/executer/exstoren.c \
	interpreter/executer/exstorob.c \
	interpreter/executer/exsystem.c \
	interpreter/executer/exutils.c \
	interpreter/parser/psargs.c \
	interpreter/parser/psloop.c \
	interpreter/parser/psopcode.c \
	interpreter/parser/psparse.c \
	interpreter/parser/psscope.c \
	interpreter/parser/pstree.c \
	interpreter/parser/psutils.c \
	interpreter/parser/pswalk.c \
	interpreter/parser/psxface.c \
	namespace/nsaccess.c \
	namespace/nsalloc.c \
	namespace/nsdump.c \
	namespace/nsdumpdv.c \
	namespace/nseval.c \
	namespace/nsinit.c \
	namespace/nsload.c \
	namespace/nsnames.c \
	namespace/nsobject.c \
	namespace/nsparse.c \
	namespace/nssearch.c \
	namespace/nsutils.c \
	namespace/nswalk.c \
	namespace/nsxfeval.c \
	namespace/nsxfname.c \
	namespace/nsxfobj.c \
	resources/rsaddr.c \
	resources/rscalc.c \
	resources/rscreate.c \
	resources/rsdump.c \
	resources/rsinfo.c \
	resources/rsio.c \
	resources/rsirq.c \
	resources/rslist.c \
	resources/rsmemory.c \
	resources/rsmisc.c \
	resources/rsutils.c \
	resources/rsxface.c \
	tables/tbconvrt.c \
	tables/tbget.c \
	tables/tbgetall.c \
	tables/tbinstal.c \
	tables/tbrsdt.c \
	tables/tbutils.c \
	tables/tbxface.c \
	tables/tbxfroot.c \
	utilities/utalloc.c \
	utilities/utcache.c \
	utilities/utclib.c \
	utilities/utcopy.c \
	utilities/utdebug.c \
	utilities/utdelete.c \
	utilities/uteval.c \
	utilities/utglobal.c \
	utilities/utinit.c \
	utilities/utmath.c \
	utilities/utmisc.c \
	utilities/utmutex.c \
	utilities/utobject.c \
	utilities/utresrc.c \
	utilities/utstate.c \
	utilities/utxface.c \
	
	
	
	
	

sources = \


asm_sources = \
	
CLEAN_OBJ = \
	debugger/*.o \
	disassembler/*.o \
	events/*.o \
	hardware/*.o \
	interpreter/dispatcher/*.o \
	interpreter/executer/*.o \
	interpreter/parser/*.o \
	namespace/*.o \
	tables/*.o \
	utilities/*.o \	

all: libacpica.a

clean:
	$(RM) *.o libacpica.a $(CLEAN_OBJ)

libacpica.a: $(sources:.cc=.o) $(c_sources:.c=.o) $(asm_sources:.asm=.o)
	ar cru $@ $?

%.o : %.asm
	$(REDIR) $(AS) -fwin32 $< -o $@

%.o: %.c
	$(REDIR) $(CC) $(OC_OPT) -c $< -o $@

%.o: %.cc
	$(REDIR) $(CC) $(OCC_OPT) -c $< -o $@

